import request from '@/utils/request';
/* 登录管理 */
export const goToLogin = ({ username, password }) => request({
    url: '/admin/base/login',
    method: 'POST',
    data: { username, password }
});

/* 省市区 */
export const regionList = params => request({
    url: '/business/area/list',
    method: 'POST',
    data: params
}); // 区域列表
// 设置新密码
export const changePassword = params => request({
    url: '/admin/users/setPassword',
    method: 'POST',
    data: params
});
// 更换员工头像
export const updateImg = params => request({
    url: '/admin/users/updateImg',
    method: 'POST',
    data: params
});
// 发送短信验证码
export const sendTpSms = params => request({
    url: '/admin/base/sendTpSms',
    method: 'POST',
    data: params
});
// 忘记密码
export const forgetpassword = params => request({
    url: '/admin/users/forgetpassword',
    method: 'POST',
    data: params
});
// 退出登录
export const exitLogin = params => request({
    url: '/admin/base/logout',
    method: 'POST',
    data: params
});
// 获取命令牌
export const getTicket = params => request({
    url: '/auth/getTicket',
    method: 'GET',
    params
}).then(({ data }) => {
    return data;
});
// 修改密码
export const resetUserPasswd = params => request({
    url: '/users/appUserResetPasswd',
    method: 'POST',
    data: params
}).then(res => {
    return res;
});
// 获取验证码
export const getImageCode = params => request({
    url: '/auth/getImageCode',
    method: 'GET',
    params,
    // 返回数据格式
    responseType: 'blob',
    // 跳过状态不是2000的校验
    skipStatusVaild: true
});
// 获取登录信息
export const accountLogin = params => request({
    url: '/auth/accountLogin',
    method: 'Post',
    params
}).then(({ data }) => {
    return data;
});

// 获取手机验证码
export const getTelCode = params => request({
    url: '/auth/getTelCode',
    method: 'Post',
    params
}).then(({ data }) => {
    return data;
});
// 获取手机号登录
// export const mobileLogin = params => request({
//     url: '/auth/mobileLogin',
//     method: 'Post',
//     params
// }).then(({ data }) => {
//     return data;
// });
export const mobileLogin = params => request({
    url: '/auth/drugLogin',
    method: 'Post',
    params
}).then(({ data }) => {
    return data;
});
// ---------------个人中心----------------------
// 设置用户签名信息
export const setUserSign = params => request({
    url: '/users/setUserSign',
    method: 'Post',
    data: params
}).then(({ data }) => {
    return data;
});
// 获取用户签名信息
export const getUserSign = params => request({
    url: '/users/getUserSign',
    method: 'GET',
    params
});
// 通过密码获取用户签名信息
export const getSignByPasswd = params => request({
    url: '/users/getSignByPasswd',
    method: 'GET',
    params
});
